<template>
  <div>
      <h1>登陆中........</h1>
      {{code}}
      {{token}}
  </div>
</template>

<script>
export default {
    name:'jb',
    data(){
        return{
            code:'',
            token:''
        }
    },
    methods:{
        get_code(){
            var code = this.$route.query.code
            this.code = code
        },
        weibo_login(){
            this.axios.get('lou/weibo?code='+this.code).then(res=>{
                console.log(res)
                this.token=res.data.token
              
                if(res.data.code==200){

                    localStorage.setItem('toekn',this.token)
                  
                    this.$router.push('index')

                }else{
                    this.$router.push('bdweibo')
                }
            })
        }
    },
    created(){
        this.get_code()
        this.weibo_login()
    }

}
</script>